/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.blitscreen.utils.monitor 
{
	import com.blitscreen.render.DrawPass;
	import com.bourre.structures.Range;
	import com.kairos.utils.monitor.AbstractAverageField;	

	/**
	 * Base class for monitoring average values from
	 * a <code>DrawPass</code> object.
	 * 
	 * @author 	Cedric Nehemie
	 * @see		com.kairos.utils.monitor.AverageField
	 */
	public class AbstractAverageDrawPassMonitorField extends AbstractAverageField 
	{
		/**
		 * Reference to the target <code>DrawPass</code> object.
		 */
		protected var _oDrawPass : DrawPass;
		
		/**
		 * Initialize behaviors of <code>AbstractAverageDrawPassMonitorField</code>.
		 * 
		 * @param 	drawPass 	<code>DrawPass</code> object used
		 * 					 	as source for this field.
		 * @param 	name		<code>String</code> name of the field.
		 * @param 	val			<code>Number</code> start value of the field.
		 * @param 	unit		<code>String</code> of the unit for the field.
		 * @param 	dr			<code>Range</code> of displayed values.
		 * @param 	limit		<code>Number</code> of values in the average. A value
		 * 						of <code>-1</code> will does that the average will
		 * 						contains all registered values.		
		 * @param 	col			<code>Number</code> color of the field.
		 */
		public function AbstractAverageDrawPassMonitorField ( 	drawPass : DrawPass, 
																name : String = "Untitled",
																val : Number = 0, 
																unit : String = "ms", 
																dr : Range = null, 
																limit : int = -1, 
																col : Number = NaN )
		{
			super( name, val, unit, dr, limit, col );
			setDrawPass( drawPass );
		}
		
		/**
		 * Defines the <code>DrawPass</code> object used
		 * as source for this field.
		 * 
		 * @param drawPass <code>DrawPass</code> object used
		 * 					 as source for this field.
		 */
		public function setDrawPass ( drawPass : DrawPass ) : void
		{
			_oDrawPass = drawPass;
		}
	}
}
